# -*- coding: utf-8 -*-
# filename: handle.py


import json
from lottery.view import mysql_util
def prize_result(request):
    try:
        webData = json.loads(request.body)
        prizeLevel = str(webData['prizeLevel'])
        winners = eval(webData['winners'])
        conn = mysql_util.getconn()
        for winner in winners:
            param = (prizeLevel, winner)
            conn.execute('update sign set prize_level=%s where mobile=%s',param)
        result = {'result':True,'msg':winners}
        return json.dumps(result)
    except Exception as e:
        return e.args
